<?php 

	namespace Home\Model;
		use Think\Model;
	class CategoryModel extends Model{
		public function getCate()
		{
			$cates = M('category')->select();
			// var_dump($cates);
			$temps = [];
			foreach ($cates as $cate) {
				if ($cate['fid']==0) {
					$temps[]=$cate;
				}
			}
			foreach ($temps as $k => $temp) {
				foreach ($cates as $cate) {
					if ($cate['fid']==$temp['id']) {
						$temps[$k]['son'][]=$cate;
					}
				}
			}
			return $temps;
		}

}













 ?>